<?php
/* 
 *  Linonline - OpenSource
 * 
 *  This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */

if(isset($_POST['username'])&& isset($_POST['password'])){
    if( $_POST['password'] != "" && $_POST['username']!= "" ){
        $login = $player->login($_POST['username'],$_POST['password'],$_POST['remember']);
        if($login == true){
            echo "<script>load('./?do=stats', 'top-panel');</script>";
        }else{
            echo "<center><br><br><br><br><br>Access denied<br>
            <a href='javascript:load(\"./?do=login\",\"top-panel\");'>Back</a></center>";
        }
    }else{
        echo "<center><br><br><br><br><br>Every field is required!<br>
            <a href='javascript:load(\"./?do=login\",\"top-panel\");'>Back</a></center>";
    }
}else{  
?>

<center><form action="" method="POST" name="login">
    <br>
    <b>Login</b><br>
    <br>
    Username:<br>
    <input size="16" name="username"><br>
    Password:<br>
    <input size="16" type="password" name="password"><br>
    Remember <input type="checkbox" name="remember"><br>
    <br>
    <input type="submit" value="Login" name="submit"><br>
    <br>
    <a href="javascript:load('./?do=register','content')">Register</a>
    </form>
</center>
<?php
}
?>